#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django import forms
from models import *

# Register your models here.
class CommentAdmin(admin.ModelAdmin):
    list_display = ('user_id','artilce_id','create_date','poll_num')

class ArticleAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField:{
            'widget':forms.Textarea(
                attrs={
                    'row':41,
                    'cols':100
                }
            )
        },
    }   #fromfield_overrides可以更改字段在后台默认显示。
    list_display = ('title','author','create_date','poll_num')

class ColumnAdmin(admin.ModelAdmin):
    list_display = ('name','intro')
class AuthorAdmin(admin.ModelAdmin):
    list_display = ('name','profile')

admin.site.register(Column,ColumnAdmin)
admin.site.register(Article,ArticleAdmin)
admin.site.register(Comment,CommentAdmin)
admin.site.register(Author,AuthorAdmin)
#admin.site.register(NewUser)
